{extend name="layout" /}
{block name="content"}
<div class="layui-form" lay-filter="LAY-app-course-category-form" id="LAY-app-course-category-form">
    <div class="layui-form-item">
        <label class="layui-form-label">上级分类</label>
        <div class="layui-input-inline">
            <select name="parent_id" lay-verify="required">
                <option value="0">顶级分类</option>
                {foreach $categories as $key=>$vo }
                <option value="{$vo.id}" {if $category && $vo['id'] == $category['parent_id']}selected{/if}>{$vo.html}{$vo.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">分类名称</label>
        <div class="layui-input-inline">
            <input type="text" name="name" value="{$category.name|default=''}" lay-verify="required"
                   placeholder="请输入..." autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">分类图标</label>
        <div class="layui-input-inline">
            <input type="text" name="icon" value="{$category.icon|default=''}"
                   placeholder="请选择图片" autocomplete="off" class="layui-input">
        </div>
        <button style="float: left;" type="button" class="layui-btn" layadmin-event="select_image">选择图片</button>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-inline">
            <input type="number" name="sort" value="{$category.sort|default=0}" lay-verify="required"
                   placeholder="请输入..." autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-inline">
            <select name="status" lay-verify="required">
                <option value="1" {if $category && $category.status == '1'}selected{/if}>启用</option>
                <option value="0" {if $category && $category.status == '0'}selected{/if}>禁用</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-app-course-category-submit" id="LAY-app-course-category-submit" value="确认">
    </div>
</div>
{include file='editor' /}
{/block}
{block name="js"}
<script>
    layui.use(['index', 'form'], function(){
        var $ = layui.$
            ,form = layui.form ;
    })
</script>
{/block}